package com.bba.manager.common.model.search;

import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.time.LocalDate;
import java.time.LocalDateTime;

@Data
/**
 * Elasticsearch文档注解，用于指定索引名称和是否创建索引
 * indexName: 指定文档对应的索引名称为"customer"
 * createIndex: 设置为true表示当索引不存在时自动创建索引
 */
@Document(indexName = "customer",createIndex = true)
public class CustomerES {
    @Id
    @Field(type = FieldType.Long)
    private Long id;
    @Field(name = "name", type = FieldType.Text, analyzer = "ik_max_word", searchAnalyzer = "ik_smart")
    private String name;
    @Field(name="phone", type = FieldType.Keyword)
    private String phone;
    @Field(name="idCard",type = FieldType.Keyword)
    private String idCard;
    @Field(name = "createTime", type = FieldType.Date)
    private LocalDate createTime;
}
